﻿using UnityEngine;
namespace FrameWorkSong
{
    public static class TransfromExtention
    {
        /// <summary>
        /// transform设置x
        /// </summary>
        /// <param name="transform">本transform</param>
        /// <param name="x">x</param>
        public static void setLocalPosX(this Transform transform, float x)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.x = x;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// transform设置y
        /// </summary>
        /// <param name="transform"></param>
        /// <param name="y"></param>
        public static void setLocalPosY(this Transform transform, float y)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.y = y;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// transform设置z
        /// </summary>
        /// <param name="transform"></param>
        /// <param name="z"></param>
        public static void setLocalPosZ(this Transform transform, float z)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.z = z;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// transform设置xy
        /// </summary>
        /// <param name="transform"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public static void setLocalPosXY(this Transform transform, float x,float y)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.x = x;
            vector3.y = y;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// transform设置xz
        /// </summary>
        /// <param name="transform"></param>
        /// <param name="x"></param>
        /// <param name="z"></param>
        public static void setLocalPosXZ(this Transform transform, float x, float z)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.x = x;
            vector3.z = z;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// transform设置yz
        /// </summary>
        /// <param name="transform"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        public static void setLocalPosYZ(this Transform transform, float y, float z)
        {
            Vector3 vector3 = transform.localPosition;
            vector3.z = z;
            vector3.y = y;
            transform.localPosition = vector3;
        }
        /// <summary>
        /// 标准化
        /// </summary>
        /// <param name="transform"></param>
        public static void identity(this Transform transform)
        {
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            transform.localScale = Vector3.one;
        }


    }
}
